import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue()],
    resolve: {
        extensions: [".js", ".jsx", ".ts", ".tsx", ".json", ".vue"],
        alias: [
            {
                find: "@",
                replacement: "/src",
            },
        ],
    },
    server: {
        proxy: {
            "/api": {
                target: "https://wwwimages2.adobe.com", //代理的服务地址，可以理解为/api等于https://api.hello.com
                secure: true, // 配置https
                changeOrigin: true, //允许跨域请求
                rewrite: (path) => path.replace(/^\/api/, ""), //重写路径，替换请求地址中的/api 为空
            },
        },
    },
});
